package com.tusuo.stds.rest;

import org.parceler.Parcel;

import java.util.List;

/**
 * @author J.Huang
 * @version 1.0
 *
 */
@Parcel
public class AreaList extends ApiResult {
    public static final String EXTRA_NAME = AreaList.class.getName();

    public int Total;
    public List<Area> Data;

    @Parcel
    public static class Area {
        public static final String EXTRA_NAME = Area.class.getName();

        public int Id;
        public String Name;
        public int Type;    // 1:直辖市
        public List<Area> Children;

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Area area = (Area) o;

            if (Id != area.Id) return false;
            if (Type != area.Type) return false;
            if (Name != null ? !Name.equals(area.Name) : area.Name != null) return false;
            return Children != null ? Children.equals(area.Children) : area.Children == null;
        }

        @Override
        public int hashCode() {
            int result = Id;
            result = 31 * result + (Name != null ? Name.hashCode() : 0);
            result = 31 * result + Type;
            result = 31 * result + (Children != null ? Children.hashCode() : 0);
            return result;
        }

        @Override
        public String toString() {
            return "Area{" +
                    "Id=" + Id +
                    ", Name='" + Name + '\'' +
                    '}';
        }
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AreaList areaList = (AreaList) o;

        if (Total != areaList.Total) return false;
        return Data != null ? Data.equals(areaList.Data) : areaList.Data == null;
    }

    @Override
    public int hashCode() {
        int result = Total;
        result = 31 * result + Data.hashCode();
        return result;
    }

    @Override
    public String toString() {
        return "SchoolList{" +
                "Total=" + Total +
                ", Data=" + Data +
                '}';
    }
}
